﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Infragistics.Windows.TilePanel;

namespace FXSStation.Modules.SharedInfrastructureModule.Extentions.TileView
{
    public class BoolToSecondaryStateConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                if ((WorkspaceItemState)value == WorkspaceItemState.MinimizedExpanded)
                    return true;
                else return false;
            }
            return Binding.DoNothing;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                if ((bool)value == true)
                    return WorkspaceItemState.MinimizedExpanded;
                else return WorkspaceItemState.MinimizedCollapsed;
            }
            return Binding.DoNothing;
        }

        #endregion
    }
    
}
